module.exports = (function() {
    var express = require('express');
    var router = express.Router();
    var path = require('path');
    var uid = require('uid');
    router.get('/', function(req, res) {
        console.log(req.cookies);
        if (!req.cookies.password) {
            res.redirect('/register1');
        } else {
            res.sendFile(path.join(__dirname, './../views/register2.html'));
        }
    });
    var redis = require('redis');
    router.post('/', function(req, res) {
        var body = req.body;
        for (var c in req.cookies) {
            if (c === 'username') {
                continue;
            } else {
                res.clearCookie(c);
            }
        }
        res.redirect('/login');
    });
    return router;
})();
